package com.heze.xunhuan.vo;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页视图对象
 *
 * @author heze-xunhuan
 */
@Data
public class PageVO<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 数据列表
     */
    private List<T> list;

    /**
     * 当前页码
     */
    private Integer page;

    /**
     * 每页大小
     */
    private Integer size;

    /**
     * 总记录数
     */
    private Long total;

    /**
     * 是否还有更多
     */
    private Boolean hasMore;

    public PageVO() {
    }

    public PageVO(List<T> list, Integer page, Integer size, Long total) {
        this.list = list;
        this.page = page;
        this.size = size;
        this.total = total;
        this.hasMore = (page * size) < total;
    }
}

